package com.fengwk.support.thread;

import java.util.concurrent.CountDownLatch;

import com.fengwk.support.function.Void;

/**
 * CountDownLatch工作包装
 * 
 * @author fengwk
 *
 */
public class CountDownLatchWork implements Runnable {

	private Void.Params0 workFun;
	private CountDownLatch cdl;
	
	public CountDownLatchWork(Void.Params0 workFun) {
		this.workFun = workFun;
	}
	
	@Override
	public void run() {
		if (workFun != null) {
			workFun.apply();
		}
		cdl.countDown();
	}

	public CountDownLatch getCdl() {
		return cdl;
	}

	public void setCdl(CountDownLatch cdl) {
		this.cdl = cdl;
	}
	
}
